<template>
	
	
	<view class="bg" :style="{backgroundImage:'url('+imagesurl+'/images/blueBg1.png)'}">
		<view class="circle" @click="qiandao">
			<u-image src="/static/qiandao.png" width="120" height="60" mode="widthFix" v-if="!isqiandao" class="rili">
			</u-image>
			<u-image src="/static/rili.png" width="88" height="88" mode="widthFix" v-else class="rili"></u-image>
			<view class="tag">
				<text v-if="!isqiandao">您今日还没有签到</text>
				<text v-else>今日获得{{todayintegral}}积分</text>
			</view>
		</view>
		<view style="width: 500rpx;text-align: center;color: #FFFFFF;font-size: 28rpx;margin: auto;">
			每日签到即可获取积分
		</view>

		<view class="total">
			<u-cell-item title="累计获得积分" :title-style="{fontSize:'28rpx'}" :border-bottom="fasle" hover-class="none" @click="go">
			</u-cell-item>
			<view class="jifen">
				{{integral}}
			</view>
		</view>

		<rule titleID="5"></rule>

	</view>
</template>

<script>
	import rule from '../../components/rule.vue';
	import url from '@/common/baseUrl.js';

	export default {
		components: {
			rule
		},
		data() {
			return {
					imagesurl: url.imageUrl,
				isqiandao: "",
				todayintegral: '',
				integral: '',

			}
		},
		onLoad() {
			this.get()
		},
		methods: {

			get() {
				this.$u.post('/api/user/information', {

				}, {}).then(res => {
					this.isqiandao = res.data.signState;
					this.integral = res.data.integral

				}).catch(err => {})
				
				
				this.$u.post('/api/index/getCommission', {
				
				}, {}).then(res => {
				    this.todayintegral=res.data.integralSign
				
				}).catch(err => {})
				
				
				
			},
			qiandao() {
				this.$u.post('/api/user/signIn', {

				}, {}).then(res => {

                     this.get()

				}).catch(err => {})

			},
			go(){
				uni.navigateTo({
					url:"../jifenshop/index"
				})
			}
		}
	}
</script>

<style>
	.bg {
	/* 	background-image: url(../../static/blueBg.png); */
		width: 100%;
		min-height: 100%;
		background-size: cover;
		display: inline-block;
	}

	.circle {
		background: #FFFFFF;
		width: 200rpx;
		height: 200rpx;
		background: #FFFFFF;
		border-radius: 100%;
		margin: 40rpx auto;
		position: relative;
	}

	.rili {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);

	}

	.tag {
		position: absolute;
		right: -220rpx;
		background: #FF6450;
		border-radius: 60rpx 60rpx 60rpx 0px;
		text-align: center;
		color: #FFFFFF;
		padding: 10rpx 30rpx;
		font-size: 24rpx;
	}

	.total {
		width: 690rpx;
		height: 220rpx;
		margin: 40rpx auto 0rpx auto;
		background: #FFFFFF;
		border-radius: 40rpx;
	}

	.jifen {
		color: #628DFF;
		font-size: 60rpx;
		margin-left: 20rpx;
	}
</style>
